#include<cstdio>
#include<cmath>
#include<cstring>
const int maxn=5100;
struct point
{
	int x,y;
};
struct line
{
	point up,down;
}a[maxn];
struct v
{
	point start,end;
};
//int min(double x,double y){return x<y?x:y;}
//int max(double x,double y){return x>y?x:y;}
int ans[maxn];
double crossProduct(v *v1,v *v2)
{
	int x1= v1->end.x - v1->start.x;
	int y1= v1->end.y - v1->start.y;
	int x2= v2->end.x - v2->start.x;
	int y2= v2->end.y - v2->start.y;

	return x1*y2-x2*y1;
}
int main()
{
	int n,m,x1,y1,x2,y2,xi,yi,ui,li;
	while(scanf("%d%d%d%d%d%d",&n,&m,&x1,&y1,&x2,&y2)&&n)
	{
		memset(ans,0,sizeof(ans));
		point t,t1,t2;
		t.x=x1;t.y=y2;a[0].down=t;
		t.x=x1;t.y=y1;a[0].up=t;
		t.x=x2;t.y=y2;a[n+1].down=t;
		t.x=x2;t.y=y1;a[n+1].up=t;
		t1.y=y2;t2.y=y1;
		for(int i=1;i<=n;i++)
		{
			scanf("%d%d",&ui,&li);
			t1.x=li;t2.x=ui;
			a[i].down=t1;a[i].up=t2;
		}
		for(int i=1;i<=m;i++)
		{
			scanf("%d%d",&xi,&yi);
			point p;
			p.x=xi;p.y=yi;
			for(int j=0;j<=n;j++)
			{
				v v1,v2,v3,v4;

				v1.start=a[j].down;v1.end=a[j].up;
				v2.start=a[j].down;v2.end=p;
				v3.start=a[j+1].down;v3.end=p;
				v4.start=a[j+1].down;v4.end=a[j+1].up;
				if(crossProduct(&v1,&v2)<0&&crossProduct(&v3,&v4)<0)
				{						
					ans[j]++;
					break;
				}
			}
		}
		for(int i=0;i<=n;i++)
			printf("%d: %d\n",i,ans[i]);
		printf("\n");
	}
	return 0;
}





